Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

303
Views
"VIDEOJS: WARN: Player "media" is already initialized" when it is not

I currently experience a small issue where I receive a warning from video.js which is as following:

VIDEOJS: WARN: Player "media" is already initialized. Options will not be applied.

The bizarre thing is that it has not been initialized. But rather it is within a jQuery's $(document).ready.

The relevant code is:

<script src="//vjs.zencdn.net/5.19.1/video.min.js"></script>

<script>
    $(document).ready(function() {
        var player = videojs('media', {
            fluid: true,
            playbackRates: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2]
        });
    });
<script>

It know it has something to do with when how fast these resources get loaded, because every now and then the warning will not appear and the options are applied.

I do need this the player initialized once the "document is ready", though. How can I go about this issue?

Any help I would greatly appreciate!

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

I had the same problem. Videojs gets automatically initialized when the data-setup attribute is present in the <video> tag.

Remove data-setup and the player will not initialize by itself, the warning will not show up anymore when you execute the JS code now:

var player = videojs('media', options);

Now you can define the options and simply do ("media" is the id of your videoplayer):

var options = {
    "playbackRates": [1, 1.5, 2],
};

var video = videojs('media', options);

video.ready(function() {
    // …
});
over 4 years ago · Santiago Trujillo Report

0

I also face the same problem. Videojs gets automatically initialized

Just Remove "data-setup" and the player will not initialize by itself

remove data-setup

over 4 years ago · Santiago Trujillo Report

0

use this code after mounted() in vue

beforeDestroy() {
    if (this.player) {
        this.player.dispose()
    }
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!